import request from '@/axios';
import {baseUrl} from "@/config/env";

export const getList = (current, size, params) => {
  return request({
    url: baseUrl+'/ucs-system/enterprise/list',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}
export const grantService = (enterpriseId, serviceIds) => {
  return request({
    url: baseUrl+'/ucs-system/enterprise/serviceGrant',
    method: 'post',
    params: {
      enterpriseId,
      serviceIds
    }
  })
}
export const rejectService = (enterpriseId, serviceIds) => {
    return request({
        url: baseUrl+'/ucs-system/enterprise/serviceReject',
        method: 'post',
        params: {
            enterpriseId,
            serviceIds
        }
    })
}
export const getEnterpriseService = (enterpriseId) => {
  return request({
    url: baseUrl+'/ucs-system/enterprise/enterprise-tree-keys',
    method: 'get',
    params: {
      enterpriseId,
    }
  })
}

export const getDetail = (id) => {
  return request({
    url: baseUrl+'/ucs-system/enterprise/detail',
    method: 'get',
    params: {
      id
    }
  })
}

export const remove = (ids) => {
  return request({
    url: '/api/ucs-system/enterprise/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

export const add = (row) => {
  return request({
    url: baseUrl+'/ucs-system/enterprise/submit',
    method: 'post',
    data: row
  })
}

export const update = (row) => {
  return request({
    url: baseUrl+'/ucs-system/enterprise/submit',
    method: 'post',
    data: row
  })
}

export const initAdmin = (enterpriseId,form) => {
    return request({
        url: baseUrl+'/ucs-system/enterprise/initAdmin',
        method: 'post',
        data: {
            enterpriseId:enterpriseId,
            adminAccount:form.adminAccount,
            adminPass:form.adminPass
        }
    })
}
